package com.hht.wblib.factory;

import static com.hht.wblib.bean.CorporationType.*;

import android.content.Context;

import com.hht.wblib.bean.ConfigurationBean;
import com.hht.wblib.bean.CorporationType;
import com.hht.wblib.hht.HhtWhiteBoard;
import com.hht.wblib.ist.IstWhiteBoard;
import com.hht.wblib.lg.LgWhiteBoard;
import com.hht.wblib.optoma.OptomaWhiteBoard;

import java.io.File;

/**
 * Author:chen'hu
 * Time:2025/1/2 14:51
 * Description:This is WhiteBoardFactory
 */
public class WhiteBoardFactory {

    private HhtWhiteBoard mHhtWhiteBoard;
    private IstWhiteBoard mIstWhiteBoard;
    private LgWhiteBoard mLgWhiteBoard;
    private OptomaWhiteBoard mOptomaWhiteBoard;
    private CorporationType mCorporationType;

    public WhiteBoardFactory(Context mContext, ConfigurationBean mConfigurationBean) {
        this.mCorporationType = fromValue(mConfigurationBean.getAnnotationBean()
                .getCorporationType());
        this.mHhtWhiteBoard = new HhtWhiteBoard(mContext, mConfigurationBean);
        this.mIstWhiteBoard = new IstWhiteBoard(mContext, mConfigurationBean);
        this.mLgWhiteBoard = new LgWhiteBoard(mContext, mConfigurationBean);
        this.mOptomaWhiteBoard = new OptomaWhiteBoard(mContext, mConfigurationBean);
    }

    public boolean openAnnotation() {
        boolean isOpen = true;
        switch (mCorporationType) {
            case HHT:
                isOpen = mHhtWhiteBoard.openAnnotation();
                break;
            case IST:
                isOpen = mIstWhiteBoard.openAnnotation();
                break;
            case LG:
                isOpen = mLgWhiteBoard.openAnnotation();
                break;
            case OPTOMA:
                isOpen = mOptomaWhiteBoard.openAnnotation();
                break;

        }
        return isOpen;
    }

    public boolean openWhiteBoard() {
        boolean isOpen = true;
        switch (mCorporationType) {
            case HHT:
                isOpen = mHhtWhiteBoard.openWhiteBoard();
                break;
            case IST:
                isOpen = mIstWhiteBoard.openWhiteBoard();
                break;
            case LG:
                isOpen = mLgWhiteBoard.openWhiteBoard();
                break;
            case OPTOMA:
                isOpen = mOptomaWhiteBoard.openWhiteBoard();
                break;

        }
        return isOpen;
    }

    public boolean sendPicturesToWhiteBoard(File file) {
        boolean isOpen = true;
        switch (mCorporationType) {
            case HHT:
                isOpen = mHhtWhiteBoard.sendPicturesToWhiteBoard(file);
                break;
            case IST:
                isOpen = mIstWhiteBoard.sendPicturesToWhiteBoard(file);
                break;
            case LG:
                isOpen = mLgWhiteBoard.sendPicturesToWhiteBoard(file);
                break;
            case OPTOMA:
                isOpen = mOptomaWhiteBoard.sendPicturesToWhiteBoard(file);
                break;
        }
        return isOpen;
    }
}
